package com.xiaocz.hblsubstitutedriving.activities.activity.dialog;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.widget.AppCompatImageView;
import android.view.View;
import android.widget.LinearLayout;

import com.uuzuche.lib_zxing.activity.CodeUtils;
import com.xiaocz.common.Common;
import com.xiaocz.common.utils.AccountManagers;
import com.xiaocz.hblsubstitutedriving.R;
import com.xiaocz.hblsubstitutedriving.base.NativeActivity;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Time:2019/11/7
 * Created by xiaocz
 * Describe 扫码下单
 */
public class DialogSweepOrderActivity extends NativeActivity {

    @BindView(R.id.layout_base)
    LinearLayout layout;
    @BindView(R.id.iv_qr_code_pay)
    AppCompatImageView ivQrCodePay;


    public static void show(Context context) {
        Intent intent = new Intent(context, DialogSweepOrderActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected int getLayoutSourceId() {
        return R.layout.dialog_bw;
    }


    @Override
    protected void initData() {
        super.initData();
        Bitmap mBitmap = CodeUtils.createImage(Common.Constant.API_H5.replace("http","https")+"qrcodeorder/order/" + AccountManagers.getUserId(), 180, 180, BitmapFactory.decodeResource(getResources(), R.mipmap.logo));
        ivQrCodePay.setImageBitmap(mBitmap);
    }

    @OnClick({R.id.tv_down})
    public void onClick(View v){
        switch (v.getId()){
            case R.id.tv_down:
                DialogCardActivity.show(mContext);
                finish();
                break;
        }
    }
}
